//页面调取微信api接口文件（http请求除外）
var bottomDialogJs = require('./../../plugIn/bottomDialog/bottomDialog.js');
var bottomDialog;

var wxMethodJs = require('./../../libs/wxMethod.js');
var $ = wxMethodJs.WxMethod();

(function () {

  var pluginThis;
  var pageThis;

  var goTologinDialog = function (tempOption) {
    this.option = tempOption;
    this.option.name = "goTologinDialog";

    pluginThis = this;
    pageThis = this.option.that;
  };

  goTologinDialog.prototype.init = function () {
    var that = this.option.that;
    bottomDialog = bottomDialogJs.BottomDialog({ that: that, name: this.option.name });

    that.opengoTologinDialog = this.opengoTologinDialog;
    that.closegoTologinDialog = this.closegoTologinDialog;
    that.goTologinDialogData = this.goTologinDialogData;
    that.openMyslsecenter = this.openMyslsecenter;
  };

  //  打开弹框
  goTologinDialog.prototype.opengoTologinDialog = function (option) {
    if (option) {
      pageThis.setData({
        commission: option.commission
      })
    }
    bottomDialog.open();
  };

  //  关闭弹框
  goTologinDialog.prototype.closegoTologinDialog = function () {
    bottomDialog.close();
  };


  //  选择某个选项
  goTologinDialog.prototype.goTologinDialogData = function (e) {
    bottomDialog.close();
  };

  goTologinDialog.prototype.openMyslsecenter = function () {
    $.openPage({
      pageUrlKey: 'disrbindexUrl',
      type: 'subPage',
      param: {
      }
    });
    bottomDialog.close();
  }

  module.exports.GoTologinDialog = function (tempOption) {
    var tempPlugin = new goTologinDialog(tempOption);
    tempPlugin.init();
    return tempPlugin;
  }

})();